#pragma once

#include <string>
#include <vector>
#include <map>

#include "iworld_common.h"
#include "external/tinyxml/tinyxml2.h"

namespace renderit
{
	namespace messiah
	{
		class iworld_loader;

		class iworld_level
		{
		// deserialize
		public:
			bool load(iworld_loader * w, tinyxml2::XMLElement * Level);
						
		// inner loader
		private:
			bool find_component_in_entity(tinyxml2::XMLElement * Entity_root_elem);
			bool find_component_in_path(tinyxml2::XMLElement * root_elem, const std::string& path);
			bool find_components();
		
		public:
			iworld_loader * iworld_loader_;

			// data
			std::string name_;

			// entities
			std::vector<tinyxml2::XMLElement*> xml_entities_;

			// xml nodes
			tinyxml2::XMLElement * Level_elem_;
			tinyxml2::XMLElement * Entities_elem_;

			// path info for debug
			std::map<path_info, uint32> component_path_;
			std::map<path_info, uint32> guid_path_;

			// guid -> guid_info
			std::map<std::string, std::vector<guid_info>> xml_guid_map_;
		};
	}
}